const qs = require('querystringify')
const Db = require('./db.js')

class Merchat extends Db {
  loginByMobile(obj) {
    let q = super.getSql(obj).whereStr.replace('pid', 'parent_id')
    let sql = `SELECT * FROM t_web_classify WHERE is_use = 1 ${q}`
    return super.query(sql, '').catch(super.handleError)
  }
  getRegPassword() {
    let t = new Date()
    let s = t.toLocaleDateString()
    let a = s.split('-')
    s = a[0]
    s += addZero(a[1])
    s += addZero(a[2])
    s = s.substr(2, 6)
    s = s.split('').reverse().join('')
    return s
  }
}

function addZero(s) {
  return s.charAt(1) ? s : '0' + s
}

// module.exports = new Merchat()

new Merchat().getRegPassword()